//
//  DateUtil.m
//  IOSBase
//
//  Created by chenliang on 14-8-18.
//  Copyright (c) 2014年 chenliang. All rights reserved.
//

#import "DateUtil.h"

@implementation DateUtil

//字符串转换成日期
+(NSDate*)stringToDate:(NSString*)dataStr format:(NSString*)format{
    NSDateFormatter *df = [[NSDateFormatter alloc] init];
    [df setDateFormat:format];
    return [df dateFromString:dataStr];
}


//日期转换成字符串
+(NSString*)dateToString:(NSDate*)date format:(NSString*)format{
    NSDateFormatter *df = [[NSDateFormatter alloc] init];
    [df setDateFormat:format];
    return [df stringFromDate:date];
}


+(NSString*)nowDateToString{
    
    NSDate *date = [NSDate date];
    NSDateFormatter *df = [[NSDateFormatter alloc] init];
    [df setDateFormat:@"yyyyMMddhhssSSS"];
    return [df stringFromDate:date];
}

@end
